<script type="text/javascript">
function get_addr(){
	if( document.getElementById('home_addr').checked == true ){
		jQuery.each( $("#home INPUT"), function(i, val){
			$("#mailing INPUT:eq("+ i +")").val( $("#home INPUT:eq("+ i +")").val() );
		});
	}
	else {
		jQuery.each( $("#home INPUT"), function(i, val){
			$("#mailing INPUT:eq("+ i +")").val( $("#mailing_copy INPUT:eq("+ i +")").val() );
		});
	}
}
function save_mailing_addr(){
	document.mailing_addr_form.submit();
}
</script>
<div id="Account">
<form action="" method="post" name="mailing_addr_form">
	<div class="Notice">Please ensure that the information below is correct<br /><br /></div>
	<h2>Homeowner Information</h2>
	<table id="home">
	  <tr>
	    <td width="30%">Name: </td>
	    <td><input type="text" id="manager_name" name="name" size="40" value="<?php echo $manager->title." ".$manager->firstname." ".$manager->surname;?>" readonly></td>
	  </tr>
	  <tr>
	    <td>Address: </td>
	    <td><input type="text" id="manager_address1" name="manager[address1]" size="40" value="<?php echo $manager->address1;?>"></td>
	  </tr>
	  <tr>
	    <td>Other Address: </td>
	    <td><input type="text" id="manager_address2" name="manager[address2]" size="40" value="<?php echo $manager->address2;?>"></td>
	  </tr>
	  <tr>
	    <td>City: </td>
	    <td><input type="text" id="manager_city" name="manager[city]" size="40" value="<?php echo $manager->city;?>"></td>
	  </tr>
	  <tr>
	    <td>State/Country: </td>
	    <td><input type="text" id="manager_state" name="manager[state]" size="40" value="<?php echo $manager->state;?>"></td>
	  </tr>
	  <tr>
	    <td>Country: </td>
	    <td><input type="text" id="manager_country" name="manager[country]" size="40" value="<?php echo $manager->country;?>"></td>
	  </tr>
	  <tr>
	    <td>Postcode: </td>
	    <td><input type="text" id="manager_postcode" name="manager[postcode]" size="40" value="<?php echo $manager->postcode;?>"></td>
	  </tr>
	  <tr>
	    <td>Email: </td>
	    <td><input type="text" id="manager_email" name="manager[email]" size="40" value="<?php echo $manager->email;?>"></td>
	  </tr>
	  <tr>
	    <td>Telephone: </td>
	    <td><input type="text" id="manager_telephone" name="manager[telephone]" size="40" value="<?php echo $manager->telephone;?>"></td>
	  </tr>
	</table>
	<br />
	<div class="Notice">Please tell us where you would like your reservation payment checks sending to</div>
	<p>
		<input type="radio" onclick="get_addr()" name="manager[mailing_addr]" value="HOME" id="home_addr" <?php echo($manager->mailing_addr == "HOME" ? "checked" : "")?>> <label for="home_addr">Mail to my home address</label><br />
		<input type="radio" onclick="get_addr()" name="manager[mailing_addr]" value="COMPANY" id="mgmt_company" <?php echo($manager->mailing_addr == "COMPANY" ? "checked" : "")?>> <label for="mgmt_company">Mail to my Management company</label>
	</p>
	<h2>Mailing Address</h2>
	<table id="mailing">
	  <tr>
	    <td width="30%">Name: </td>
	    <td><input type="text" id="manager_mailing_name" name="name" size="40" value="<?php echo $manager->title." ".$manager->firstname." ".$manager->surname;?>" readonly></td>
	  </tr>
	  <tr>
	    <td>Address: </td>
	    <td><input type="text" id="manager_mailing_address1" name="manager_mailing[address1]" size="40" value="<?php echo $MailingAddr->address1;?>"></td>
	  </tr>
	  <tr>
	    <td>Other Address: </td>
	    <td><input type="text" id="manager_mailing_address2" name="manager_mailing[address2]" size="40" value="<?php echo $MailingAddr->address2;?>"></td>
	  </tr>
	  <tr>
	    <td>City: </td>
	    <td><input type="text" id="manager_mailing_city" name="manager_mailing[city]" size="40" value="<?php echo $MailingAddr->city;?>"></td>
	  </tr>
	  <tr>
	    <td>State/Country: </td>
	    <td><input type="text" id="manager_mailing_state" name="manager_mailing[state]" size="40" value="<?php echo $MailingAddr->state;?>"></td>
	  </tr>
	  <tr>
	    <td>Country: </td>
	    <td><input type="text" id="manager_mailing_country" name="manager_mailing[country]" size="40" value="<?php echo $MailingAddr->country;?>"></td>
	  </tr>
	  <tr>
	    <td>Postcode: </td>
	    <td><input type="text" id="manager_mailing_postcode" name="manager_mailing[postcode]" size="40" value="<?php echo $MailingAddr->postcode;?>"></td>
	  </tr>
	  <tr>
	    <td>Email: </td>
	    <td><input type="text" id="manager_mailing_email" name="manager_mailing[email]" size="40" value="<?php echo $MailingAddr->email;?>"></td>
	  </tr>
	  <tr>
	    <td>Telephone: </td>
	    <td><input type="text" id="manager_mailing_telephone" name="manager_mailing[telephone]" size="40" value="<?php echo $MailingAddr->telephone;?>"></td>
	  </tr>
	</table>
	<table id="mailing_copy" style="display: none;">
	  <tr>
	    <td width="30%">Name: </td>
	    <td><input type="text" name="name" size="40" value="<?php echo $manager->title." ".$manager->firstname." ".$manager->surname;?>" readonly></td>
	  </tr>
	  <tr>
	    <td>Address: </td>
	    <td><input type="text" size="40" value="<?php echo $MailingAddr->address1;?>"></td>
	  </tr>
	  <tr>
	    <td>Other Address: </td>
	    <td><input type="text" size="40" value="<?php echo $MailingAddr->address2;?>"></td>
	  </tr>
	  <tr>
	    <td>City: </td>
	    <td><input type="text" size="40" value="<?php echo $MailingAddr->city;?>"></td>
	  </tr>
	  <tr>
	    <td>State/Country: </td>
	    <td><input type="text" size="40" value="<?php echo $MailingAddr->state;?>"></td>
	  </tr>
	  <tr>
	    <td>Country: </td>
	    <td><input type="text" size="40" value="<?php echo $MailingAddr->country;?>"></td>
	  </tr>
	  <tr>
	    <td>Postcode: </td>
	    <td><input type="text" size="40" value="<?php echo $MailingAddr->postcode;?>"></td>
	  </tr>
	  <tr>
	    <td>Email: </td>
	    <td><input type="text" size="40" value="<?php echo $MailingAddr->email;?>"></td>
	  </tr>
	  <tr>
	    <td>Telephone: </td>
	    <td><input type="text" size="40" value="<?php echo $MailingAddr->telephone;?>"></td>
	  </tr>
	</table>
	<input type="hidden" name="form" value="save_mailing_addr">
</form>
<?php $KToolBar->addLink('<a href="#" onclick="save_mailing_addr()"><img border="0" alt="Save" src="'.ADMIN_COMPONENT_PATH.'images/save_f2.png"/><br />Save</a>');?>
<?php $KToolBar->addLink('<a href="?option='.COMPONENT_NAME.'&user=owner&page=home"><img border="0" alt="Cancel" src="'.ADMIN_COMPONENT_PATH.'images/cancel_f2.png"/><br />Cancel</a>');?>
</div>
<script>
get_addr();
</script>